-----------------------------------------------------------------------------
--
-- Module      :  Main
-- Copyright   :
-- License     :  AllRightsReserved
--
-- Maintainer  :
-- Stability   :
-- Portability :
--
-- |
--
-----------------------------------------------------------------------------

module Main where
import FlsParser
import MetaDataAnalyzer
import System.IO
import qualified Data.ByteString.Lazy.Char8 as L
import Data.Maybe (fromJust)
import MetaMongo
import MetaUI
import MdServer

-- need to pull the args from command line
main =
  do bodyFile <- getFile "testData/teddy.fls"
     testMongo (getBLines bodyFile)


startServer = initServer "2047"

--Fast timeline using a heap to sort all data. using mongodb instead....
testSort bodyFile =
   let result = fromJust(maybeParseE bodyFile)
       timeline = basicTimeline result
   in do print (length timeline)
         print ("Finished generating heap")
         print ("printing timeline to a.out")
         printTimeLine (timeline)

testParseEvents bodyfile =
   let result = fromJust (maybeParseE bodyfile)
   in do print (length result)
         print result

printTimeLine xs = do fh <- openFile "testData/output" WriteMode
                      mapM (printae fh) xs
                      return ()
                   where
                      printae fh = (hPutStrLn fh).show

